{//前台电子合同购买课时界面模板}
<include file="Public:header" />
<script type="text/javascript">
    $(function(){
        $('[name=price]').focus();
        $('[name=b]').click(function(){
            var year_kind=$('[name=year_kind]').val();
            var km_kind=$('[name=kecheng_kind]').val();
            var sk_kind=$('[name=shouke_kind]').val();
            var gm_keshi=$('[name=keshi_num]').val();
            var ht_id=$('[name=ht_id]').val();

            if($('[name=keshi_num]').val()==''){
                $('[name=pop]').html('反馈信息：课时数量不能为空！');
                $('[name=keshi_num]').val('');
                $('[name=keshi_num]').focus();
                return false;
            }

            if(!isNumber($('[name=keshi_num]').val())){
                $('[name=pop]').html('反馈信息：课时数量必须为数字！');
                $('[name=keshi_num]').val('');
                $('[name=keshi_num]').focus();
                return false;
            }

            $.post(app_url+"/ppts-qt_hetong_gmks_check",{'year_kind':year_kind,'sk_kind':sk_kind,'ht_id':ht_id,'gm_keshi':gm_keshi},function(data){chuli_check(data.data);},'json');
            //$("form:first").submit();
        });

        function chuli_check(c){
            switch(c){
                case 3:
                    $('[name=pop]').html('反馈信息：您所购买的课时数量为0！');
                    break;
                case 0:
                    $('[name=pop]').html('反馈信息：所剩余的课时数量不足！');
                    break;
                case 1:
                    $('[name=pop]').html('反馈信息：剩余课时数为0！');
                    break;
                case 10:
                    $("form:first").submit();
                    break;
                default:
                    $('[name=pop]').html('反馈信息：系统异常错误，请刷新后重新购买课时，如问题依旧，请联系技术部！');
                    break;
            }
        }


        {/*数据请求提示*/}
        $('[name=pop]').ajaxStart(function(){
            $('[name=pop]').html('反馈信息：<img src="'+base_url+'/images/loading.gif" />数据请求中...请稍后...');
        });



        function isNumber(field)
         {
            var   Ret   =   true;
            var   NumStr= "0123456789 ";
            var   chr;
            for   (i=0;i <field.length;++i)
            {
            chr=field.charAt(i);
            if   (NumStr.indexOf(chr,0)==-1)
            {
            Ret=false;
            }
            }
            return(Ret);
        }
    });
</script>
<div style="margin-left: 10px;">
    <span class="title_text">学员姓名：</span>{$stu_name}&nbsp;&nbsp;&nbsp;&nbsp;购买课时操作
    
<table width="300" border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse" bordercolor="#000000">
    <form  method="post" action="{:U('ppts/save_qt_goumaikeshi')}" name="gmks">
    <tr>
        <td width="100%" colspan="2">
            <span class="title_text">剩余未购买课时情况：</span>
            <br /><br />
            年级类型&nbsp;&nbsp;&nbsp;&nbsp;
            授课类型&nbsp;&nbsp;&nbsp;&nbsp;
            剩余课时<br />
            <foreach name="sy_keshi_list" item="sy">
                {$sy.year_kind}&nbsp;&nbsp;&nbsp;&nbsp;
                {$sy.sk_kind}&nbsp;&nbsp;&nbsp;&nbsp;
                {$sy.gm_keshi}<br />
            </foreach>
        </td>
    </tr>
    <tr>
        <td width="30%" align="right">购买科目：</td>
        <td width="70%">
            <select name="kecheng_kind">
                <option value="语文">语文</option>
                <option value="数学">数学</option>
                <option value="英语">英语</option>
                <option value="物理">物理</option>
                <option value="化学">化学</option>
                <option value="生物">生物</option>
                <option value="历史">历史</option>
                <option value="地理">地理</option>
                <option value="政治">政治</option>
            </select>
        </td>
    </tr>
    <tr>
        <td width="30%" align="right">年级类型：</td>
        <td width="70%">
            <select name="year_kind">
                <foreach name="kpname_list" item="kp">
                    <option value="{$kp.kp_name}">{$kp.kp_name}</option>
                </foreach>
            </select>
        </td>
    </tr>
    <tr>
        <td width="30%" align="right">授课类型：</td>
        <td width="70%">
            <select name="shouke_kind">
                <option value="普通一对一">普通一对一</option>
                <option value="3A一对一">3A一对一</option>
                <option value="普通一对多">普通一对多</option>
                <option value="3A一对多">3A一对多</option>
            </select>
        </td>
    </tr>
    <tr>
        <td width="30%" align="right">购买数量：</td>
        <td width="70%">
            <input type="text" size="10" name="keshi_num" />
        </td>
    </tr>
    <tr>
        <td width="100%" style="color:red;" name="pop" colspan="2">反馈信息：</td>
    </tr>
    <tr>
        <td width="100%" colspan="2" align="center">
            <input type="hidden" value="{$ht_id}" name="ht_id" />
            <input type="hidden" value="{$stu_id}" name="stu_id" />
            <input type="button" value="确认购买" name="b" />&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="button" onclick="javascript:self.parent.tb_remove();" value="取  消" name="c" />
        </td>
    </tr>
    </form>
</table>
    
</div>
<include file="Public:ender" />
